//
//  VVNavigationController.m
//  Weiweiyunshi
//
//  Created by 张旭峰 on 2017/2/9.
//  Copyright © 2017年 王译. All rights reserved.
//

#import "VVNavigationController.h"

#import "MainViewController.h"
#import "UIImage+Image.h"
#define NavBarColor [UIColor colorWithRed:250/255.0 green:227/255.0 blue:111/255.0 alpha:1.0]
@interface VVNavigationController ()

@end

@implementation VVNavigationController


+ (void)load
{
    
    
    UIBarButtonItem *item=[UIBarButtonItem appearanceWhenContainedIn:self, nil ];
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    dic[NSFontAttributeName]=[UIFont systemFontOfSize:15];
    dic[NSForegroundColorAttributeName]=[UIColor blackColor];
    [item setTitleTextAttributes:dic forState:UIControlStateNormal];
    
//    UINavigationBar *bar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[self]];
//    
//    [bar setBackgroundImage:[UIImage imageWithColor:NavBarColor] forBarMetrics:UIBarMetricsDefault];
//    NSMutableDictionary *dicBar=[NSMutableDictionary dictionary];
//    
//    dicBar[NSFontAttributeName]=[UIFont systemFontOfSize:15];
//    [bar setTitleTextAttributes:dic];
    UINavigationBar * bar = [[UINavigationBar alloc]init];
    //
    //[bar setBackgroundImage:[UIImage imageWithColor:NavBarColor] forBarMetrics:UIBarMetricsDefault];
    NSMutableDictionary *dicBar=[NSMutableDictionary dictionary];
    
    dicBar[NSFontAttributeName]=[UIFont systemFontOfSize:15];
    [bar setTitleTextAttributes:dic];

    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    [self.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:(UIBarMetricsDefault)];
//      [self.navigationBar setShadowImage:[[UIImage alloc] init]];//这个不设置  bar的底部会有一条黑线;
    //修改bar的整体的颜色
//    self.navigationBar.barTintColor = [UIColor colorWithRed:18 green:118 blue:218];
//    [self.navigationBar setTintColor:[UIColor whiteColor]];
    
    
//    [self.navigationBar setTintColor:[UIColor blackColor]];
    // 默认nav是白色的
//    [self.navigationBar setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor blackColor] }];
    
    
    
//    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"header_back_icon"] style:UIBarButtonItemStyleDone target:self action:@selector(pop)];
    
    
//    UIBarButtonItem *backitem = [[UIBarButtonItem alloc]initWithCustomView:[UIImage imageNamed:@"header_back_icon"]];
//    self.navigationItem.leftBarButtonItem = backitem;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}
- (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated
{
    
    // 如果这个控制器不是第一个控制器,那么应该设置隐藏tabbar的属性
    if (self.viewControllers.count > 0) {
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}
/*
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleLightContent;
}

*/

@end
